<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>button-border-animation</title>
    <style>
        .animated-border-button {
            outline: none;
            background-color: #2396ef;
            padding: 12px 40px 10px;
            border: none;
            position: relative;
            color: #fff;
            border-radius: 4px;
            cursor: pointer;
        }
        .animated-border-button::before,
        .animated-border-button::after {
            content:"";
            position: absolute;
            border: 0 solid transparent;
            height: 0;
            width: 24px;
            transition: all .3s cubic-bezier(0.075, 0.82, 0.165, 1);
        }
        .animated-border-button::before {
            border-top: 2px solid #2396ef;
            top: -4px;
            right: 0;
        }
        .animated-border-button::after {
            border-bottom: 2px solid #2396ef;
            bottom: -4px;
            left: 0;
        }
        .animated-border-button:hover::before,
        .animated-border-button:hover::after {
            width: 100%;
        }
    </style>
</head>

<body>
    <button class="animated-border-button">Submit</button>
</body>

</html>